<?php

class UtilityController extends MSA_Controller_Action
{
	public function init()
	{
		parent::init();
	}
    
    public function captchaAction()
    {
    	$size = $this->getRequest()->getParam('size', 'normal');
    	$temp = Zend_Registry::get('config');
    	$config = $temp['production']['captcha'][$size];
    	$captcha = new Zend_Captcha_Image(array('font' => $config['font'],
    											'session' => new Zend_Session_Namespace('captcha'),
    											'fontsize' => $config['fontSize'],
    											'wordLen' => $config['wordLen'],
    											'width' => $config['width'],
    											'height' => $config['height'],
    											'imgDir' => $config['imgDir'],
    											'imgUrl' => $config['imgUrl'],
    											'dotNoiseLevel' => $config['dotNoiseLevel'],
    											'lineNoiseLevel' => $config['lineNoiseLevel']));
    	$this->setLayout('layout');
    	$captcha->generate();
    	$imgPath = $captcha->getImgUrl() . $captcha->getId() . $captcha->getSuffix();
    	$this->outputPng($imgPath);
    }


}

